package com.geek.javase.ch02.test6;

/*
 *@author wangpeng
 *2025/10/10 20:06
 *@description TODO
 */
public class Orders {
    //属性
    private String no;
    //一对一关联  用户信息  （双向关联）
    private Users user;
    //一对多关联  商品信息
    private Goods[] goods;

    //查看订单详情
    public void showOrderDetail(){
        System.out.println("订单号："+no);
        System.out.println("下单者："+user.getName());
        System.out.println("=====商品信息=====");
        if(goods!=null){
            for (Goods good : goods) {
                if(good!=null){
                    good.showGoods();
                }
            }
        }
    }
    public Orders() {
    }

    public Orders(String no, Users user, Goods[] goods) {
        this.no = no;
        this.user = user;
        this.goods = goods;
    }

    public String getNo() {
        return no;
    }

    public Users getUser() {
        return user;
    }

    public Goods[] getGoods() {
        return goods;
    }
    public void setNo(String no) {
        this.no = no;
    }
}
